var mysql = require('mysql');
var connection = mysql.createConnection({
    host: 'localhost',
    user: 'root',
    password: '123456',
    database: 'test'
});
connection.connect();

// 创建表
var createTable = `CREATE TABLE if not exists users (
    id INT NOT NULL AUTO_INCREMENT ,
    name VARCHAR(18) NOT NULL ,
    pass VARCHAR(100) NOT NULL ,
    org VARCHAR(100) NOT NULL ,
    PRIMARY KEY (id)
) ENGINE = MyISAM CHARSET=utf8 COLLATE utf8_general_ci`

// 删除表
var deleteTable = 'drop table users'

// 添加一列
var addCol = 'Alter table users add column time VARCHAR(100) NOT NULL'



// 添加数据
var insertSQL = 'insert into users(name,pass,org,col) values("wangwu", 454, "b","a")'
// 查找数据
var selectSQL = 'select * from users limit 10';
var selectSQL2 = 'select * from users where name like "%san"'
// 删除数据
var deleteSQL = 'delete from users where id=4';
// 修改数据
var updateSQL = 'update users set name="conan update"  where name="lisi"';


connection.query(selectSQL2, function (err, res) {
    if (err) {
        console.log(err)
    }
    console.log("Return ==> ")
    console.log(res)
})





connection.end()